package org.budo.dubbo.protocol.http.view.render.budo;

import org.budo.dubbo.protocol.http.exception.remoting.SignCheckException;

/**
 * @author lmw
 */
public class SignCheckExceptionRender {
    public ApiError buildApiError(SignCheckException exception) {
        if (exception.getFail().equals(SignCheckException.Fail.APP_KEY_EMPTY)) {
            return ApiError.APP_KEY_EMPTY;
        }

        if (exception.getFail().equals(SignCheckException.Fail.TIME_EMPTY)) {
            return ApiError.TIME_EMPTY;
        }

        if (exception.getFail().equals(SignCheckException.Fail.APP_SECRET_EMPTY)) {
            return ApiError.APP_SECRET_EMPTY;
        }

        if (exception.getFail().equals(SignCheckException.Fail.SIGN_ERROR)) {
            return ApiError.SIGN_ERROR;
        }

        return ApiError.SIGN_CHECK_FAILED;
    }
}